﻿@model PagingDataSet<ContentItem>
@{
    Layout = "app-list-2cols";
    Html.IncludeCss("~/Applications/CMS/Styles/app.css", ResourceRenderPriority.Last);

    var currentUser = UserContext.CurrentUser;
    User user = ViewData.Get<User>("user", new User());
    string userDescription = ViewData.Get<string>("userDescription", String.Empty);

    string ta = "我";
    if (currentUser == null || currentUser.UserId != user.UserId)
    {
        ta = user.Profile.ThirdPerson();
    }
    long contributeCount = ViewData.Get<long>("contributeCount", 0);
    AuditStatus? auditStatus = Request.QueryString.Get<AuditStatus?>("auditStatus", null);
    bool hasManagePermission = ViewData.Get<bool>("hasManagePermission", false);
}
@section Aside{
    @Html.Action("_Tops", "ChannelCms", new { topNumber = 5, viewName = "_Tops_Title", sortBy = ContentItemSortBy.StageHitTimes })
}

<div class="tn-box tn-widget tn-widget-content tn-corner-all spb-story-i-box">
    <div class="tn-box-content tn-widget-content tn-corner-all">
        <div class="spb-story-i">
            <div class="tn-card tn-helper-clearfix">
                <div class="tn-avatar-medium">
                    @Html.ShowUserAvatar(user.UserId, AvatarSizeType.Medium, true)
                </div>
                <div class="tn-info">
                    <p class="tn-user-name">
                        <a href="@SiteUrls.Instance().SpaceHome(user.UserId)" target="_blank" title="进入空间"><strong>@user.DisplayName</strong></a>
                        <span class="spb-user-type">
                            @Html.IdentificationType(user.UserId)
                        </span>
                    </p>
                    @if (user.Profile != null)
                    { 
                        <p class="tn-user-data">
                            @if (user.Profile.Gender == GenderType.Male)
                            { 
                                @Html.Icon(IconTypes.Male, "男")
                            }
                            else if (user.Profile.Gender == GenderType.FeMale)
                            { 
                                @Html.Icon(IconTypes.Female, "女")
                            }
                            <span class="tn-location">@Formatter.FormatArea(user.Profile.NowAreaCode)</span>
                        </p>
                    }
                    <p class="tn-stat"><span>投稿数：<em>@contributeCount</em></span></p>
                </div>
            </div>
            @if (hasManagePermission)
            {
                @Html.PresetMessage("通过审核后的资讯，将不允许编辑、删除", true)
            }
            <div class="tn-tabs">
                @using (Html.BeginForm("CmsUser", "ChannelCms", FormMethod.Get, new { id = "cmsUserForm" }))
                {
                    <ul class="tn-tabs-nav tn-border-gray tn-border-bottom tn-helper-clearfix">
                        <li class="tn-widget-content tn-border-gray tn-border-trl tn-tabs-selected"><a href="javacript:void(0)">@(ta)的投稿</a></li>
                        <li class="tn-option">
                            @if (hasManagePermission)
                            {
                                @(Html.EnumDropDownList<AuditStatus?>("auditStatus", auditStatus, "所有投稿", new { @class = "tn-dropdownlist" }))
                            }
                            @Html.FolderDropDownList("contentFolderId", Request.QueryString.GetInt("contentFolderId", 0), ContentTypeKeys.Instance().News(), optionLabel: "请选择栏目")
                        </li>
                    </ul>
                }
                <div class="tn-tabs-panel">
                    @Html.Partial("_UserContentItems", Model, ViewData)
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("select[id^='contentFolderId'],#auditStatus").live("change", function () {
            $("#cmsUserForm").submit();
        });
    });
</script>
